{js href="__STATIC__/home/css/jquery.jcrop.min.css" /}
<form>
    <div class="weui-cell">
        <div class="weui-label">
            <span>活动名称</span>
        </div>
        <div class="weui-cell__bd">
            <input type="text" class="weui-input" placeholder="为活动拟个标题(最多15个字)" name="name" data-error="请输入活动名称">
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-label">
            <span>活动时间</span>
        </div>
        <div class="weui-cell__bd">
            <input type="text" class="weui-input" placeholder="请输入活动时间" id="apply-date" name="start_time" data-error="请选择活动时间" readonly>
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-label">
            <span>人数</span>
        </div>
        <div class="weui-cell__bd">
            <input type="number" class="weui-input" placeholder="请输入活动人数限制" name="population" data-error="请输入活动最大参与人数">
        </div>
    </div>
    <div class="weui-cell weui-cell_access">
        <div class="weui-label">
            <span>详细地址</span>
        </div>
        <div class="weui-cell__bd show_friend_map">
            <p class="activity_address">正在获取地址...</p>
            <input type="hidden" class="weui-input" placeholder="请输入活动的详细地址" name="address" data-error="请选择活动详细地址">
            <input type="hidden" name="lat" value="{$data.lat|default=''}" data-error="请选择活动详细地址"/>
            <input type="hidden" name="lng" value="{$data.lng|default=''}" data-error="请选择活动详细地址"/>
        </div>
        <div class="weui-cell__ft"></div>
    </div>
    <div class="weui-cell weui-cell_access">
        <div class="weui-label">
            <span>是否AA制</span>
        </div>
        <div class="weui-cell__bd">
            <p class="whether">
                <a href="javascript:;" data-is-aa="1">是</a>
                <a href="javascript:;" class="active" data-is-aa="2">否</a>
            </p>
            <input name="is_aa" type="hidden" value="2">
            <p class="fs06 cl-9999">选择"否"则由发起人买单</p>
        </div>
    </div>
    <div class="weui-cell weui-cell_access">
        <div class="weui-label">
            <span>活动保证金</span>
        </div>
        <div class="weui-cell__bd">
            <span class="cl-c40">{$Think.config.system.margin}</span>元
        </div>
    </div>
    <div class="weui-cell ">
        <div class="weui-label">
            <span>群聊</span>
        </div>
        <div class="weui-cell__bd">

        </div>
        <div class="weui-cell__ft">
            <label for="switchCP" class="weui-switch-cp">
                <input id="switchCP" class="weui-switch-cp__input" type="checkbox" checked="checked" name="is_group_chat" value="1">
                <div class="weui-switch-cp__box"></div>
            </label>
        </div>
    </div>

    <div class="weui-cell">
        <div class="weui-label">
            <span>现场图片(三张)</span>
        </div>
        <!--大图路径放在alt-->
        <div class="weui-cell__bd img_20_1 viewImage">
            <!--<img class="viewPhone" data-img="0" src="__STATIC__/home/images/product8.png" alt="__STATIC__/home/images/product8.png">-->
            <a href="javascript:;" style="position: relative;">
                <input class="uploaderInput weui-uploader__input" type="file" accept="image/*" data-field="image" data-quantity="more" data-width="375" data-height="250"/>
                <img src="__STATIC__/home/images/addphone.png" alt="">
                <input type="hidden" name="image_1" value="{$data.image_1|default=''}" data-error="请上传三张活动现场图"/>
                <input type="hidden" name="image_2" value="{$data.image_2|default=''}" data-error="请上传三张活动现场图"/>
                <input type="hidden" name="image_3" value="{$data.image_3|default=''}" data-error="请上传三张活动现场图"/>
            </a>
        </div>
    </div>
    <div class="weui-cell explain">
        <div class="weui-label">
            <span>活动说明</span>
        </div>
        <div class="weui-cell__bd ">
            <textarea class="weui-textarea" placeholder="说明活动的具体细节" rows="5" name="msg" data-error="请输入活动说明"></textarea>
        </div>
    </div>
    <div class="weui-cell explain" style="margin-bottom: 3rem">
        <div class="weui-label">
            <span>活动条款</span>
        </div>
        <div class="weui-cell__bd ">
            提交活动即代表您已经同意本 <a href="{:url('base/activity_agreement')}" style="color: #5a5aff;">《协议》</a>
        </div>
    </div>
    <a href="javascript:;" class="cl-f publish">提交</a>
</form>

<script type="text/javascript" src="__STATIC__/home/jquery_weui/js/swiper.min.js"></script>
{js href="__STATIC__/home/js/jquery.jcrop.min.js" /}
{js href="__STATIC__/home/js/jquery.jcrop.upload.js" /}
{js href="__STATIC__/home/js/exif.js" /}
<script src="__STATIC__/home/js/map.js?v={php} echo time();{/php}"></script>

<script>
    SCOPE.upload_img_type = '2';
    $(function () {
        //        活动时间
        $("#apply-date").click(function () {
            $('input').blur();
        });
        $("#apply-date").datetimePicker({
            title: '活动时间',
            min: "1990-12-12",
            max: "2022-12-12 12:12",
            onChange: function (picker, values, displayValues) {
                console.log(values);
            }
        });
//        是否AA制
        $('.whether').on('click','a',function (e) {
            e.preventDefault();
            $("input[name='is_aa']").val($(this).data('is-aa'));
            $(this).addClass('active').siblings().removeClass('active')
        });
        var swiper = new Swiper('.swiper-container', {
            pagination: '.swiper-pagination',
            slidesPerView: 1,
            loop:true,
            paginationClickable: true,
            spaceBetween: 5,
            autoplay:3000
        });
        var swiper = new Swiper('.swiper-container1', {
            slidesPerView: 'auto',
            spaceBetween: 5,
        });
//        控制publish是否显示
        var dataOrderCount=$('.mtab_list1 .js-list1.active').attr('dataOrder');

        $('.publish').css({
            bottom:'0',
            left:'0',
            right:'0'
        });

        /**
         * 提交申请
         */
        $(".publish").click(function () {
            var _form = $('form');
            if (!_check_form(_form)) {
                return false;
            }
            $.showLoading();
            $.ajax({
                type : 'POST',
                url : '{:url("send_activity")}',
                data : _form.serialize(),
                dataType : 'json',
                success : function (msg) {
                    if (msg.code == 200) {
                        window.location.href = "{:url('sponsor')}?id=" + msg.data.id;
                    } else {
                        $.hideLoading();
                        $.toptip(msg.msg);
                    }
                }
            });
        });
    });
</script>